#ifndef MAINFORM_H
#define MAINFORM_H
extern "C"
{
#include <wsim/websocket_common.h>
}
#include "moveableframelesswindow.h"

#include <QWidget>
#include "../wsim_client.h"
#include "collapseview.h"
#include <QMap>
#include <QSystemTrayIcon>
#include <QAction>
#include "transferform.h"
#include "teamform.h"
#include "../model/virtualkey.h"
#include "dialogreguser.h"

namespace Ui {
class MainForm;
}

class MainForm : public MoveableFramelessWindow
{
    Q_OBJECT

public:
    explicit MainForm(int fd,QWidget *parent = 0);
    ~MainForm();

    void setNickname(QString nickname);
private slots:

    void doChangeColor();
    void onThemeColorChange(QString colorStr);
    void doClose();
    void doReMood();
    void doReClientList();
    void doReOrganClientList();
    void doReGroupClientList();
    void showWindow();
    void showTransfer();
    void onTrayClick();
    void doRegUser();

protected:
      QWidget*getDragnWidget();
      CollapseView* pCollapseView;
      CollapseView* pCollapseView_2;
      CollapseView* pCollapseView_3;
      QList<clientItem> m_clientList;
     QMap<QString,TeamForm*> m_teamMap;

     VirtualKey* pTeamVK;
     void onCloseWS();
private:
    Ui::MainForm *ui;
    QSystemTrayIcon *pSysTrayIcon;
    QMenu* tray_menu;

    DialogRegUser dialogReg;

    void slotAddClient(clientItem item,int t);
    void slotDropClient(clientItem item);
    void slotMessage(WS_MESSAGE msg);
    void slot_wsFile(wsimBIN_head head);
    void slot_wsRequest(int ffd,int magic,QString request,linkItem item);
    void slot_wsTransfer(int tfd,int ffd,int magic,int index);
     void slot_wsTeamTransfer(int  tfd,int  ffd,int  magic,int index,QByteArray barray);
     void slot_wsTeamClose(int tfd,int ffd,int magic);
     void slot_wsTeamCommand(int tfd,int ffd,int magic,QString command);
};

#endif // MAINFORM_H
